<template>
    <div class="wrap">
        <div class="yearWrap" v-for="(item,index) in list" :key="item.id">
            <p class="year">
                <span>{{item.year}}年</span>
                <img src="@/assets/img/news/yuan.png" alt="yuan">
            </p>
            <div 
                class="item"
                :class="!i&&!index?'active':''"
                :key="el" 
                v-for="(el,i) in item.content.split('#')">
                <div class="left">{{item.year}}</div>
                <div class="right">
                    <img
                        v-if="!i&&!index"
                        src="@/assets/img/news/star_red.png" 
                        alt="star">
                    <img
                        v-else
                        src="@/assets/img/news/star.png" 
                        alt="redStar">
                    <span>{{el}}</span>
                </div>
            </div>
        </div>
    </div>
</template>

<script>
import request from '@/request.js';
export default {
    data(){
        return {
            list:[]
        }
    },
    mounted(){
        this.getData();
    },
    methods:{
        getData(){
            request.get(`/pc/news/findBreakingNews`)
                .then(res=> {
                    this.list = res.data;
                })
        }
    }
}
</script>

<style lang="less" scoped>
.wrap {
    margin-bottom: 40px;
    .yearWrap {
        padding-top: 55px;
        position: relative;
        .year {
            width: 126px;
            justify-content: flex-end;
            position: relative;
            right: -12px;
            display: flex;
            align-items: center;
            font-size:24px;
            font-weight:400;
            color:rgba(51,51,51,1);
            img {
                margin-left: 10px;
                width: 22px;
                height: 22px;
            }
        }
        .item {
            margin-top: 20px;
            display: flex;
            align-items: center;
            height: 34px;
            color:rgba(102,102,102,1);
            .left {
                flex: 0 0 126px;
                text-align: right;
                padding-right: 18px;
                box-sizing: border-box;
                font-size:16px;
                font-weight:400;
            }
            .right {
                flex:1;
                display: flex;
                align-items: center;
                span {
                    font-size:14px;
                    font-weight:400;
                }
                img {
                    width: 17px;
                    height: 17px;
                    margin:0 8px 0 40px;
                }
            }
        }
        .active {
            color:#D73A42;
            .right {
                span {
                    font-size: 24px;
                }
            }
        }
        &::before {
            content:'';
            display: block;
            width: 1px;
            height: 100%;
            background-color: #DCDCDD;
            position: absolute;
            left: 126px;
            top: 0;
            z-index: -1;
        }
    }
}
</style>